package com.hh.erp.util;

import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 模拟redis缓存
 */
@Data
public class RedisModel implements Serializable {

    private String key;
    private String value;
    private LocalDateTime createtime;

    public RedisModel(String key, String value, LocalDateTime createtime, LocalDateTime overtime) {
        this.key = key;
        this.value = value;
        this.createtime = createtime;
        this.overtime = overtime;
    }

    private LocalDateTime overtime;

    /**
     * 为false 则代表已过期
     * @return
     */
    public Boolean getStatus() {
        if(overtime.compareTo( LocalDateTime.now()) > 0) {
            return true;
        }
        return false;
    }

}
